package practice;

public class quicksort {
    public static void quick(int []arr,int low,int high)
    {
        int i,j,temp,t;
        if(low>high) return;
        i = low;
        j = high;
        temp = arr[low];
        while (i<j)
        {
            while (i<j&&temp<=arr[j])j--;
            while (i<j&&temp>=arr[i])i++;
            if(i<j)
            {
                int x = arr[i];
                arr[i] = arr[j];
                arr[j] = x;
            }
        }
        arr[low] = arr[i];
        arr[i] = temp;

        quick(arr,low,j-1);
        quick(arr,j+1,high);

    }

    public static void main(String[] args) {
        int []nums = {6, 1, 2, 7, 9, 8, 4, 5, 10, 8};
        quick(nums,0, nums.length-1);
    }
}
